﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>任务调度</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link href="~/layui/css/modules/layer/default/global.css" rel="stylesheet" />
    <link href="~/layui/css/modules/layer/common.css" rel="stylesheet" />
    <link id="layuicss-skinlayercss" rel="stylesheet" href="~/layui/css/modules/layer/default/layer.css" media="all">
    <script src="~/layui/jquery-1.6.4.min.js"></script>
</head>
<body>
    <div class="header">
        <div class="main">
            <a class="logo" href="/" title="Fly">任务调度平台</a>
            <ul class="layui-nav fly-nav-user" style="float: right;">
                <li class="layui-nav-item">
                    <a href="/user/login/">退出</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="main layui-clear">

        <div class="layui-main itkee-main">

            <ul class="site-idea">

                @{

                    foreach (var obj in ViewBag.ServiceList)
                    {

                        <li class="serviceli">
                            <fieldset class="layui-elem-field layui-field-title">
                                <legend>@obj.Job_Name</legend>
                                <p>
                                    运行状态：
                                    @if (@obj.Job_State == 0)
                                    {
                                        <span class="layui-badge layui-bg-blue">运行中</span>
                                    }
                                    else if (@obj.Job_State == -1)
                                    {
                                        <span class="layui-badge">未运行</span>
                                    }
                                    else if (@obj.Job_State == 2)
                                    {
                                        <span class="layui-badge">完成</span>
                                    }
                                    else if (@obj.Job_State == 3)
                                    {
                                        <span class="layui-badge">错误</span>
                                    }
                                    else if (@obj.Job_State == 1)
                                    {
                                        <span class="layui-badge">暂停</span>
                                    }
                                    else if (@obj.Job_State == 4)
                                    {
                                        <span class="layui-badge">阻塞</span>
                                    }
                                </p>
                                <p>共运行：@obj.FunctionCount 次</p>
                                <p>上次运行时间：@obj.LastTime  ( @obj.ProcessTime s )</p>
                                <p>下次运行时间：@obj.NextTime</p>

                                <div class="layui-btn-group">
                                    @if (@obj.Job_State == -1 || @obj.Job_State == 1 || @obj.Job_State == 3 || @obj.Job_State == 4)
                                    {
                                        <button id="StartService" data-taskid="@obj.ID" class="layui-btn layui-btn-primary layui-btn-small" title="开始运行">
                                            <i class="layui-icon" style="color: #5fb878;">&#xe623;</i>
                                        </button>
                                    }
                                    <button id="RefreshService" data-taskid="@obj.ID" class="layui-btn layui-btn-primary layui-btn-small" title="刷新">
                                        <i class="layui-icon" style="color: #5fb878;">&#x1002;</i>
                                    </button>
                                    @if (@obj.Job_State > -1)
                                    {
                                        <button id="DeleteService" data-taskid="@obj.ID" class="layui-btn layui-btn-primary layui-btn-small" title="删除">
                                            <i class="layui-icon">&#xe640;</i>
                                        </button>
                                    }
                                </div>
                            </fieldset>
                        </li>

                    }

                }

                <li class="serviceli" style="text-align: center;">
                    <fieldset class="layui-elem-field layui-field-title">
                        <legend>新增服务</legend>
                        <img id="newService" style="height: 109px;cursor: pointer;" src="~/layui/css/modules/images/addService.jpg" />
                    </fieldset>
                </li>
            </ul>
        </div>

    </div>

    <div class="footer">
        <p><a href="http://fly.layui.com/">任务调度</a> 2017 © <a href="http://超.ren/">超.ren</a></p>
        <p>
            <a href="#" target="_blank">产品授权</a>
            <a href="#" target="_blank">版本</a>
            <a href="#" target="_blank">v0.0.0.1</a>
        </p>
    </div>
    <script src="/layui/layui.js"></script>
    <script src="~/layui/layer/layer.js"></script>
    <script src="~/Script/Index.js"></script>
</body>
</html>